#pragma once
#ifndef xResManager_h__
#define xResManager_h__
#include "xIManager.h"

namespace NTools
{
	class xDevice;
	class xResManager : public xIResManager
	{
	protected:
		const static TUint mMaxNameLen = 128;
	private:
		typedef struct _tInfo
		{
			xRes* self;
			TUint hashID;
			TUint flag;
			TUint refNumb;
			TChar name[mMaxNameLen];
			_tInfo():self(VNull),hashID(0),flag(0),refNumb(0){}
		}tInfo;
		typedef struct _tManagers  
		{
			TUint hashID;
			xResManager* manager;
		}tManagers;
		tManagers managers[256];
	public:
		~xResManager(){}
	public:
		TResult CreateRes(TChar* type,xRes** res,TChar* name,TInt flag);
		TResult DeleteRes(TChar* type,xRes* res);

		TResult ObtainRes(TChar* type,xRes** res,TChar* name);
		TResult ReleaseRes(TChar* type,xRes** res);
	};
}

#endif // xResManager_h__